	<?php
		echo $this->Html->css('../plugins/fancybox/jquery.fancybox-1.3.4');		
		echo $this->Html->script('../plugins/fancybox/jquery.mousewheel-3.0.4.pack');
		echo $this->Html->script('../plugins/fancybox/jquery.fancybox-1.3.4.pack');
		echo $this->Html->script('fbplugin');
	?>

<div id="content">
				<!-- main news -->
				<div id="left">
					<div id="page-title">
						<?php echo $data['News']['title']?>
						
						
					</div>
												
					<div id="main-news-day"><?php echo $this->Common->datevie('D, d/m/Y',$data['News']['created'])?> | <font style="color:#c96464"><?php echo date('H:i',strtotime($data['News']['created'])+GMT)?></font></div>				
					<div id="main-news-description"><?php echo $data['News']['content']?></div>
				</div>	
				<!-- other news -->
				<?php if(count($data0)>0){?>
				<div id="right">
					<div id="others_title">Tin tức khác</div>
					<?php foreach($data0 as $k=>$v){?>
					<div class="other-news<?php echo (($k+1)%2+1)?>">
						<a title="<?php echo $v['News']['title']?>" href="<?php echo $this->Seo->link('/news/detail/'.$v['News']['id']);?>">
					<img alt="<?php echo $v['News']['title']?>" width=91 src="<?php echo empty($v['News']['image'])?$this->webroot.'img/thumb_noimg.jpg':$this->webroot.'uploaded/News/thumb/'.$v['News']['image'];?>" />
						<?php echo $v['News']['title']?>
						</a>
					</div>
					<?php }?>					
					<div style="clear:both;height:20px;"></div>
					<div id="main-news-more"><a href="<?php echo $this->Seo->link('/news');?>">Xem thêm</a></div>	
					<div style="clear:both;height:20px;"></div>
				
					
					
									
				</div>
				<?php }?>
				<div style="clear:both;"></div>
				
				<br />
				
				<!-- donate button -->
				<?php if($data['News']['donate']){?>
				<div>
				<?php echo $this->requestAction('static_pages/getContent/donate') ?>
				</div>
				
				<div style="width:660px;text-align: center">
					<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
					<input type="hidden" name="cmd" value="_donations">
					<input type="hidden" name="business" value="G9W7AJMQ85Z7E">
					<input type="hidden" name="lc" value="VN">
					<input type="hidden" name="item_name" value="Thien Nguyen SCY - <?php echo $this->Common->replaceUnicodeChar($data['News']['title']," ")?>">
					<input type="hidden" name="item_number" value="<?php echo $data['News']['id']?>">
					<input type="hidden" name="currency_code" value="USD">
					<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">
					<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
					<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
					</form>

				</div>
				<br />
				<?php }?>
				
				<!-- facebook button -->
				<div>
					<div style="float:left;"><g:plusone size="medium" annotation="none"></g:plusone></div>
					<div style="float:left;margin-left:10px;" class="fb-like" data-href="<?php echo $this->Seo->link('/news/detail/'.$data[$uses[0]]['id']);?>" data-send="false" data-layout="button_count" data-width="10" data-show-faces="true"></div>
					<div  id="fbfacepile">
						<fb:facepile href="<?php echo $this->Seo->link('/news/detail/'.$data[$uses[0]]['id']);?>" width="300" max_rows="1"></fb:facepile>
					</div>
					<div style="clear:both;height:20px;"></div>
					<div id="fbstatus">
						<div style="display: none;width:80px;margin-top:10px;" id="btnRead"  class="uiButton"  >
							<input  type="button" value="I've read it" onclick="postRead()" />
						</div>
					</div>
					<div id="fbjoin"></div>
					<div style="clear:both;"></div>
				</div>	
				
				
				
				<br />				
				<div class="fb-comments" data-href="<?php echo $this->Seo->link('/news/detail/'.$data[$uses[0]]['id']);?>" data-num-posts="<?php echo $webConfig['fbCommentNop']?>" data-width="650"></div>				
				<div id="fb-root"></div>
				
				<div style="clear:both;height:20px"></div>
</div>



<script type="text/javascript">
//google
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
//facebook
//for fb
var accessToken=0;
var uid=0;
var selfurl='<?php echo $this->Seo->link('/news/detail/'.$data[$uses[0]]['id'])?>';
fbplugin.selfurl=selfurl;
fbplugin.saveUserDataUrl='<?php echo $this->Seo->link('/fbs/saveuserdata');?>';
  window.fbAsyncInit = function() {
      FB.init({
        appId      : '204609776328294', // App ID
        status     : true, // check login status
        cookie     : true, // enable cookies to allow the server to access the session
        xfbml      : true  // parse XFBML
      });

  
      
      FB.getLoginStatus(function(response) {
  		  if (response.status === 'connected') {
  		    // the user is logged in and has authenticated your
  		    // app, and response.authResponse supplies
  		    // the user's ID, a valid access token, a signed
  		    // request, and the time the access token 
  		    // and signed request each expire
  		    fbplugin.uid = response.authResponse.userID;
  		  	fbplugin.accessToken = response.authResponse.accessToken;
  		    //call ajax show user config on this app
  		    $('#fbstatus').load('<?php echo $this->Seo->link('/fbs/loaduserdata');?>'+'/'+fbplugin.uid);
  		    
  		  	
  		  } else if (response.status === 'not_authorized') {
  		    // the user is logged in to Facebook, 
  		    // but has not authenticated your app
    		    document.getElementById('btnRead').style.display='block';
  		  } else {
  		    // the user isn't logged in to Facebook.
  		  }

  		  //show join
	  		<?php if(isset($data[$uses[0]]['activity']) && $data[$uses[0]]['activity']==1){?>
	  		showjoin(0);
	  		<?php }?>
  		 });

      

      
    };

   
    (function(d){
        var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
        js = d.createElement('script'); js.id = id; js.async = true;
        js.src = "//connect.facebook.net/en_US/all.js";
        d.getElementsByTagName('head')[0].appendChild(js);
      }(document));
    /*
(function(d, s, id) {
	  var js, fjs = d.getElementsByTagName(s)[0];
	  if (d.getElementById(id)) return;
	  js = d.createElement(s); js.id = id;
	  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
	  fjs.parentNode.insertBefore(js, fjs);
	}(document, 'script', 'facebook-jssdk'));*/
function postRead()
{
	fbplugin.getPermission('publish_actions','loaduserdata();');
}
function postJoin(){
	if(fbplugin.uid==0)
	{
		fbplugin.getPermission('publish_actions','fbplugin.join("showjoin(1);","showjoin(0);");');		
	}
	else
	{
		fbplugin.join('showjoin(1);','showjoin(0);');
	}	
}
function showjoin(flag){
	if(flag==1)
		$('#fbjoin').load('<?php echo $this->Seo->link('/fbs/fbjoin');?>'+'/'+fbplugin.uid+'?url='+fbplugin.selfurl);	
	else
		$('#fbjoin').load('<?php echo $this->Seo->link('/fbs/showjoin');?>'+'/'+fbplugin.uid+'?url='+fbplugin.selfurl);	
}
function loaduserdata(){
	$('#fbstatus').load('<?php echo $this->Seo->link('/fbs/loaduserdata');?>'+'/'+fbplugin.uid);
}





function openRecentActivity(){	
	$.fancybox({
			type : 'iframe',
			href: '<?php echo $this->Seo->link('/fbs/getuseractivity')?>'+'/'+fbplugin.uid +'/'+fbplugin.accessToken,
			padding : 5,
			width:500,
			height:500
	});

}


//show join

</script>